<?php (defined('BASEPATH')) OR exit('No direct script access allowed');

/* load the MX_Loader class */
//require APPPATH."third_party/MX/Loader.php";

class MY_Loader extends CI_Loader {
    
    /** Load a layout **/
    public function layout($view, $vars = array(), $return = FALSE)
    {        
        return $this->_ci_load(array( '_ci_path' => APPPATH . 'layouts/' . $view . EXT, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
    }
    
    /**
     * Get avatar of user
     * @param type $userid
     * @param type $avatar
     * @return type 
     */
    public function get_avatar($userid, $avatar, $size)
    {
        if(($avatar != 'no-avatar.jpg') && (!empty($userid))){
            $avatar = $userid.'/'.$avatar;
        }
        if(!empty($size)){
            $avatar = str_replace('.', '_'.$size.'.', $avatar);
        }
        
        return config_item('st_images').'/avatars/'.$avatar;
    }
}